<!DOCTYPE html>
<html lang="en">
<head>
	 <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DSL WMS CDM登陆</title>
    <!-- Loading Bootstrap -->
    <link href="/static/css/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- Loading Flat UI -->
    <link href="/static/css/flat-ui.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/css/admin.css">

    <link rel="shortcut icon" href="/static/img/dslIcon.png">
    <style type="text/css">
        /*html,body{
            height: 100%;
        }*/
        #login_logo{
            position: absolute;
            top: 0%;
            left: 15%;
            /*margin-top: %;*/
            
        }
    </style>

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
    <!--[if lt IE 9]>
      <script src="js/vendor/html5shiv.js"></script>
      <script src="js/vendor/respond.min.js"></script>
    <![endif]-->
</head>
<body class=" login-body">
          <div align="center" class="container">

	          <div id="login_logo" class="row">
		          <div><!-- class="login-icon" -->
		            <img src="/static/img/dslIcon.png" alt="DSL WMS CMD" style="width: 15%" />
                    <h4><small>DSL WMS 培训网站后台系统</small></h4>
		            
		          </div>
	          </div>


          <div class="row" style="margin-top: 15%">
            <div class="login-form col-xs-10 col-xs-offset-1 col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
            <div class="form-group">
              <input type="text" class="form-control login-field" value="" placeholder="用户名" id="login-name" />
              <label class="login-field-icon fui-user" for="login-name"></label>
            </div>

            <div class="form-group">
              <input type="password" class="form-control login-field" value="" placeholder="密码" id="login-pass" />
              <label class="login-field-icon fui-lock" for="login-pass"></label>
            </div>

            <a class="btn btn-primary btn-lg btn-block login-in" href="#">登录</a>
          </div>
          </div>
          
        </div>


    <!-- jQuery (necessary for Flat UI's JavaScript plugins) -->
    <script src="/static/js/vendor/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <!-- <script src="/static/js/vendor/video.js"></script> -->
    <script src="/static/js/flat-ui.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    	$('.login-form').on('click','a.login-in',function(){
    		var name = $('#login-name').val();
    		var password = $('#login-pass').val();
    		$.ajax({
    			url:'login',
    			async:true,
    			type:'POST',
    			data:{
    				'name' : name,
    				'password':password
    			},
    			dataType:'JSON',
    			success:function(data,textStatus,jqXHR){
    				console.log(data);
    				if (data.err != 0) {
    					alert(data.content);
    				}else if (data.err == 0) {
                        window.location.href=data.url;
                    }

    			},
    			error:function(){
    				console.log('网络出错');

    			}
    		});
    	});


//     	$.ajax({
//     url:'/comm/test1.php',
//     type:'POST', //GET
//     async:true,    //或false,是否异步
//     data:{
//         name:'yang',age:25
//     },
//     timeout:5000,    //超时时间
//     dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
//     beforeSend:function(xhr){
//         console.log(xhr)
//         console.log('发送前')
//     },
//     success:function(data,textStatus,jqXHR){
//         console.log(data)
//         console.log(textStatus)
//         console.log(jqXHR)
//     },
//     error:function(xhr,textStatus){
//         console.log('错误')
//         console.log(xhr)
//         console.log(textStatus)
//     },
//     complete:function(){
//         console.log('结束')
//     }
// })
 
	});
    </script>
    <script type="text/javascript">
        //回车键自动登录
        $('body').keydown(function(){
            if (event.keyCode == '13') {
                $('.login-in').click();
            }
        });
    </script>

  </body>
</html>
